package cn.eud.hunau.service.impl;

import cn.eud.hunau.exception.BusinessException;
import cn.eud.hunau.mapper.UserMapper;
import cn.eud.hunau.pojo.User;
import cn.eud.hunau.request.UserReq;
import cn.eud.hunau.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author hb
 * @date 2025-06-18 16:34:00
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(UserReq reqObject) {

      User user=  userMapper.queryByUserNameAndPassword(reqObject.getUsername(),reqObject.getPassword());

      //业务逻辑的判断
      if(user==null){
          throw new BusinessException("用户名或密码错误",400401);
      }
        return user;
    }
}
